﻿using System;
using System.Globalization;
using System.Windows.Data;
using System.Windows.Media;

namespace Bookworm.Controls.Utilities
{
    public sealed class ObjectToImageSourceConverter:IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            var imageSourceConverter = new ImageSourceConverter();
            return imageSourceConverter.CanConvertFrom(value.GetType()) ? imageSourceConverter.ConvertFrom(value) : null;
        }
        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
}
